package main

import (
	"context"
	"flag"
	"log"
	"shop-manager/config"
)

var (
	configFile string
)

func main() {
	log.SetFlags(log.Llongfile | log.LstdFlags | log.Ltime | log.Lmicroseconds)
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	flag.StringVar(&configFile, "c", "config.yaml", "config.yaml")
	flag.Parse()

	if err := config.Init(ctx, configFile); err != nil {
		panic(err)
	}

	s, err := CreateServer(ctx, configFile)
	if err != nil {
		panic(err)
	}
	s.Run(config.Get().Server.Addr)

	select {}
}
